package com.example.barcodeapp.utils;

import android.content.Context;
import android.graphics.Bitmap;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;

public class GlideUtile {
    public static void setImgCircle(Context context, ImageView imageView, String imgUrl) {
        //设置头像的圆角
        int round = SystemUtils.px2Dp(context, 100);
        RoundedCorners roundedCorners = new RoundedCorners(round);
        RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
        Glide.with(context).load(imgUrl).apply(options).into(imageView);
    }
    public static void setImgCircle(Context context, ImageView imageView, Bitmap bitmap) {
        //设置头像的圆角
        int round = SystemUtils.px2Dp(context, 100);
        RoundedCorners roundedCorners = new RoundedCorners(round);
        RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
        Glide.with(context).load(bitmap).apply(options).into(imageView);
    }
    public static void setImgCircle(Context context, ImageView imageView, int drawable) {
        //设置头像的圆角
        int round = SystemUtils.px2Dp(context, 100);
        RoundedCorners roundedCorners = new RoundedCorners(round);
        RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
        Glide.with(context).load(drawable).apply(options).into(imageView);
    }
}
